<?php


namespace App\Validators;


class UserValidator extends BaseValidator
{
    protected $rules = [
        'id' => ['required', 'numeric'],
        'status' => ['required', 'numeric', 'in:1,2,3'],
        'nickname' => ['required'],
        'phone' => ['required', 'regex: /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/'],
        'sex' => ['required', 'numeric']
    ];
    protected $msgs = [
        'id.required' => 'ID必填',
        'id.numeric' => 'ID错误',
        'status.required' => '审核状态必填',
        'status.numeric' => '审核状态错误',
        'status.in' => '状态值为1-3的整数',
        'nickname.required' => '昵称不能为空',
        'phone.required' => '手机号不能为空',
        'phone.regex' => '手机号格式错误',
        'sex.required' => '请选择性别',
        'sex.numeric' => '性别格式错误'
    ];
    protected $scenes = [
        'perCerAudit' => ['id', 'status'],
        'entCerAudit' => ['id', 'status'],
        'userEdit' => ['id', 'nickname', 'phone', 'sex'],
    ];
}
